const Router = require('koa-router');
const home = new Router();
const db = require('../utils/db.js');


home.get('/', async (ctx) => {
		let data = await new Promise((resolve, reject)=>{
			let sqlLang = `select * from user`;
			db.query(sqlLang, (err, data)=>{
				if(err) reject(err);
				resolve(data);	// 返回拿到的数据
			})
		})
		// console.log(await data);
		ctx.body = await data;
	})
module.exports = home;